package com.qzsoft.zhjd.materiel.modules.materieloperator.entity;

import java.util.Date;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.qzsoft.jeemis.common.validator.group.AddGroup;
import com.qzsoft.jeemis.common.validator.group.UpdateGroup;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @ClassName MaterielOperatorEntity
 * @Description 地磅操作手
 * @author linhuawei
 * @since 2022-03-31
 */
@Data
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ToString
@TableName("n_materiel_operator")
public class MaterielOperatorEntity {

    /**
     * 主键
     */
    @NotBlank(groups = UpdateGroup.class, message = "标识不可为空")
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;

    /**
     * 基地编码
     */
    @NotBlank(groups = { AddGroup.class, UpdateGroup.class }, message = "所属基地不可为空")
    private String baseCode;

    /**
     * 姓名
     */
    @NotBlank(groups = { AddGroup.class, UpdateGroup.class }, message = "姓名不可为空")
    @Length(groups = { AddGroup.class, UpdateGroup.class }, max = 20, message = "姓名不可超过{max}个字")
    private String name;

    /**
     * 账号
     */
    @NotBlank(groups = AddGroup.class, message = "账号不可为空")
    @Length(groups = AddGroup.class, max = 20, message = "账号不可超过{max}个字")
    @TableField(updateStrategy = FieldStrategy.NEVER)
    private String account;

    /**
     * 密码
     */
    @NotBlank(groups = AddGroup.class, message = "密码不可为空")
    @Length(groups = { AddGroup.class, UpdateGroup.class }, max = 20, message = "密码不可超过{max}个字")
    private String password;

    /**
     * 联系电话
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    @Length(groups = { AddGroup.class, UpdateGroup.class }, max = 11, message = "联系电话格式错误")
    private String tellphone;

    /**
     * 备注
     */
    @TableField(updateStrategy = FieldStrategy.IGNORED)
    @Length(groups = { AddGroup.class, UpdateGroup.class }, max = 200, message = "备注信息不可超过{max}个字")
    private String remark;

    /**
     * 是否启用，0否，1是
     */
    @NotNull(groups = { AddGroup.class, UpdateGroup.class }, message = "是否启用不可为空")
    @Range(groups = { AddGroup.class, UpdateGroup.class }, min = 0, max = 1, message = "是否启用错误")
    private Integer enable;

    /**
     * 添加人主键
     */
    @TableField(fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    private Long creator;

    /**
     * 添加时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date createDate;

    /**
     * 最后修改人主键
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updater;

    /**
     * 最后修改时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateDate;

}
